package com.xique.client.service.service.impl;

import com.xique.client.bean.domain.ParkLane;
import com.xique.client.mapper.ParkLaneMapper;
import com.xique.client.service.service.IParkLaneService;
import com.xique.common.core.text.Convert;
import com.xique.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 通道Service业务层处理
 * 
 * @author ww
 * @date 2019-10-07
 */
@Service
public class ParkLaneServiceImpl implements IParkLaneService
{
    @Autowired
    private ParkLaneMapper parkLaneMapper;

    /**
     * 查询通道
     * 
     * @param id 通道ID
     * @return 通道
     */
    @Override
    public ParkLane selectParkLaneById(Long id)
    {
        return parkLaneMapper.selectParkLaneById(id);
    }

    /**
     * 查询通道列表
     * 
     * @param parkLane 通道
     * @return 通道
     */
    @Override
    public List<ParkLane> selectParkLaneList(ParkLane parkLane)
    {
        return parkLaneMapper.selectParkLaneList(parkLane);
    }

    /**
     * 新增通道
     * 
     * @param parkLane 通道
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
    public int insertParkLane(ParkLane parkLane)
    {
        parkLane.setCreateTime(DateUtils.getNowDate());
        return parkLaneMapper.insertParkLane(parkLane);
    }

    /**
     * 修改通道
     * 
     * @param parkLane 通道
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
    public int updateParkLane(ParkLane parkLane)
    {
        parkLane.setUpdateTime(DateUtils.getNowDate());
        return parkLaneMapper.updateParkLane(parkLane);
    }

    /**
     * 删除通道对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
    public int deleteParkLaneByIds(String ids)
    {
        return parkLaneMapper.deleteParkLaneByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除通道信息
     * 
     * @param id 通道ID
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
    public int deleteParkLaneById(Long id)
    {
        return parkLaneMapper.deleteParkLaneById(id);
    }

}
